﻿using Drawing;
using Geometry;

namespace UserInterface.Tests.Primitives
{
    internal class ContentStub : Visual
    {
        public Size Size;
        public Size MeasureSize;

        public ContentStub(Size size)
        {
            this.Size = size;
        }

        protected override Size MeasureContent(Size upToSize, IDrawingContext context)
        {
            this.MeasureSize = upToSize;
            var size = new Size(float.IsNaN(this.Size.Width) ? upToSize.Width : this.Size.Width,
                                float.IsNaN(this.Size.Height) ? upToSize.Height : this.Size.Height);
            return size;
        }
    }
}
